using System;
using DbTracker.Core.Schema.Model;

namespace DbTracker.MsSql.Model
{
    public class Trigger : Code
    {
        public Trigger()
            : base(ObjectType.Trigger, ScripActionType.AddTrigger, ScripActionType.DropTrigger)
        { }

        /// <summary>
        /// Clona el objeto en una nueva instancia.
        /// </summary>
        public override ISchema Clone()
        {
            return new Trigger
            {
                Text = Text,
                Status = Status,
                Name = Name,
                IsDisabled = IsDisabled,
                InsteadOf = InsteadOf,
                NotForReplication = NotForReplication,
                Owner = Owner,
                Id = Id,
                IsDdlTrigger = IsDdlTrigger
            };
        }

        public Boolean IsDdlTrigger { get; set; }

        public Boolean InsteadOf { get; set; }

        public Boolean IsDisabled { get; set; }

        public Boolean NotForReplication { get; set; }

        public override Boolean IsCodeType
        {
            get { return true; }
        }

        //public override bool Compare(ICode obj)
        //{
        //    if (obj == null) throw new ArgumentNullException("obj");
        //    if (!this.ToSql().Equals(obj.ToSql())) return false;
        //    if (this.InsteadOf != ((Trigger)obj).InsteadOf) return false;
        //    if (this.IsDisabled != ((Trigger)obj).IsDisabled) return false;
        //    if (this.NotForReplication != ((Trigger)obj).NotForReplication) return false;
        //    return true;
        //}
    }
}